//
//  PingTaIHulianViewController.m
//  shopping
//
//  Created by 马田成 on 2017/10/6.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "PingTaIHulianViewController.h"

@interface PingTaIHulianViewController ()

@end

@implementation PingTaIHulianViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"平台互联"];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)changeApp:(UIButton *)sender {
    NSString *username = @"gslm";
    [self openUserPage:username];
}
- (BOOL)isInstagramInstalled {
    NSURL *instagramURL = [NSURL URLWithString:@"gslm://location?id=1"];
    return [[UIApplication sharedApplication] canOpenURL:instagramURL];
}

- (void)openUserPage:(NSString *)username {
    NSURL *fansPageURL;
    if ([self isInstagramInstalled]) {
        fansPageURL = [NSURL URLWithString:[NSString stringWithFormat:@"gslm://user?username=%@", username]];
    } else {
        fansPageURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://instagram.com/%@", username]];
    }
    [[UIApplication sharedApplication] openURL:fansPageURL];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
